//
//  main.cpp
//  Practice4
//
//  Created by 赵世杰 on 2020/6/20.
//  Copyright © 2020 zhaoshijie. All rights reserved.
//

#include <iostream>
#include <cstring>
#include <vector>
#include <array>


using namespace std;

struct CandyBar
{
    string name;
    long weight;
    int calorie;
};


struct Pizza
{
    string name ;
    double weight;
    double radius;
    
};


void printCandyBarData(CandyBar snack);

void printPizzaData(Pizza pizza);


int main(int argc, const char * argv[]) {
    // insert code here...
//    std::cout << "Hello, World!\n";
    
    
    
    /*
//    char name[20] ;
    string firstName ;
    
    cout << "What is your first name?" << endl;
    
    cin >> firstName;
    
    
    string lastName;
    
    cout << "What is your last name?" << endl;
    
    cin >> lastName;
    
    string age;
    
    cout << "What is your age?" << endl;
    
    cin >> age;
    
    
    
    cout << "FirstName: " + firstName + " lastName: " + lastName + " age: " + age << endl;
    */
    
    
    /*
    char firstName[20];
    char lastName[20];
    
    cout<< "Enter Your first name:" << endl;
    
    cin >> firstName;
    
    cout << "Enter Your last Name:" << endl;
    
    cin >> lastName;
    
    char name[40];
    
    strcpy(name, firstName);
    
    strcat(name, lastName);
    
    cout << "name: " << name << endl;
     */
    
    
    /*
    CandyBar snack;
    
    snack.name = "Macha Munch";
    snack.weight = 2.3;
    snack.calorie = 350;
    
//    cout << snack;
    
    cout << "snack Data with name:" + snack.name + " weight:" + to_string(snack.weight) + " calorie:" + to_string(snack.calorie) << endl;
    */
    
    
    
    /*
    CandyBar sanck1 = {"name1",1,100};
    CandyBar sanck2 = {"name2",2,200};
    CandyBar sanck3 = {"name3",3,300};
    
    CandyBar sanck[3] = {sanck1,sanck2,sanck3};
    
    
    
    
    for (int i=0; i<sizeof(sanck)/sizeof(CandyBar); i++) {
        
        printCandyBarData(sanck[i]);
        
//        printCandyBarData(sanck1);
        
    }
     
     */
    
    
    /*
    Pizza pizza ;
    
    printPizzaData(pizza);
    
    cout << "pizza Name :" << endl;

    cin >> pizza.name;

    cout << "pizza weight :" << endl;

    cin >> pizza.weight;
    
    cout << "pizza radius :" << endl;
    
    cin >> pizza.radius;
    
    
    printPizzaData(pizza);
     */
    
    /*
    Pizza *pizza = new Pizza();
    
    pizza->name = "pizza";
    (*pizza).weight = 1.2;
    pizza->radius = 3.14;
    
    printPizzaData(*pizza);
    */
    
    /*
    CandyBar sanck1 = {"name1",1,100};
    CandyBar sanck2 = {"name2",2,200};
    CandyBar sanck3 = {"name3",3,300};
    
    vector<CandyBar> sanck(3);
    
    sanck[0] = sanck1;
    sanck[1] = sanck2;
    sanck[2] = sanck3;
    
    
    for (int i=0; i<sanck.size(); i++) {
            
            printCandyBarData(sanck[i]);
            
            
        }
     */
    
    
    
    array<double, 3> run ;
    
    for (int i=0; i<run.size(); i++) {
        
        cout << "40吗跑的成绩: " << endl;
        
        double time ;
        
        cin >> time;
        
        run[i] = time;
        
    
        
    }
    
    double age = 0;
    
    double totalAge = 0;
    
    for (int i=0; i<run.size(); i++) {
        
        totalAge += run[i];
        
    }
    
    age = totalAge/(run.size());
    
    cout << "平均成绩：" + to_string(age) + "总成绩：" + to_string(totalAge);
    
    
    
    return 0;
}

void printCandyBarData(CandyBar snack)
{
    cout << "snack Data with name:" + snack.name + " weight:" + to_string(snack.weight) + " calorie:" + to_string(snack.calorie) << endl;
}



void printPizzaData(Pizza pizza)
{
    cout << "Pizza Data with name:" + pizza.name + " weight:" + to_string(pizza.weight) + " calorie:" + to_string(pizza.radius) << endl;
}
